import { ctcssSsoRequest } from '@core/utils/request';

export default class SsoUser {
  static fetchList = () => {
    return ctcssSsoRequest.get<null, Array<{ userId: string, userName: string }>>('/standalone/sso/user/list');
  };

  static fetchMyAuth = () => {
    return ctcssSsoRequest.get<null, Array<{ userId: string, roleList: Array<{ roleId: number, roleName: string }> }>>('/standalone/sso/user/auth/list');
  };

  static createOne = (params: { userId: string, userName: string, password: string }) => {
    return ctcssSsoRequest.post<any, null>('/standalone/sso/user/add', params);
  };

  static updateOne = (params: { userId: string, userName: string }) => {
    return ctcssSsoRequest.post<any, null>('/standalone/sso/user/update', params);
  };

  static deleteOne = (userId: string) => {
    return ctcssSsoRequest.get<any, null>('/standalone/sso/user/delete', { params: { userId } });
  };

  static resetPasswordOf = (params: { userId: string, password: string }) => {
    return ctcssSsoRequest.post<any, null>('/standalone/sso/user/update', params);
  };
}
